Refactor Session Management