move session handler to module.