Optimize the username derivation