Refactor the User handling code.