refactors retrieve user endpoint