moved session stuff into constructor