Pre-filling local username in a more generic way.
Refactored user profile update code in API.