cleaned up code in user controller