Easiest way is to hold the joystick and mainsheet in the same hand, that way when you come in the main will automatically sheet out.
Same thing counts for going out.