added user registered event, tidied up helper functions and added automatic auth...