Re-factor sessions controller