refactored users controller into user model