Fixed suspend and hibernate and improved logout

Suspend and hibernate now works properly, the logout stuff was taken from the Confluence script.