When Charlie discovers that Alan is sleepwalking, he believes its related to his brothers lack of sex following his divorce, and comes up with a cure.