refactor nickname code