Refactor sessions server