refactored generate_username service