making code more dry, fixed set-username event bug