move session out of main