refactoring retrieval of users