refactor session.js to comply style guide