Refactored User Model with tests