refactor users controller and model