Added a logout security function