Tidied up AuthenticationUtils