tidy up and logout start