move session init to a session factory