user by ids and refactoring