Refactored the account controller