added login/logout function