users api refactoring