Minor refactoring of user model to make code more readable.