implementlogout functionality