Improved username parsing