add logout and checkAuth function