Re-factored user authentication.