UserService code refactored