User model and controller refactoring