Add intial support for onLoggedIn and onLoggedOut hooks
Fix bugs, complete support for onLoggedIn and onLoggedOut
mend