Refactored user login to clean it up a bit.