optimized version, username implementation