Some refactoring on SessionsController.