restructured UserModel, added unit tests