Adjusted logic for logging users in and storing user information.