Implemented Logout function