clean up code for users and flash messages