Refined code for User model and added test for email downcasing