refactored the user viewing code