Refactored the user controller