added onLogout method