how does sex work