Refactor user model. Add auth code and tests to match.