Refactored module.
Moved auth code to auth controller.