preparations for session management (work in progress, this commit breaks compile)