Refactored code in user management section.