Session refactor