Refactor sessions controller