Added the logout method

Separated with previous pull request (now cancelled) since this can be included without breaking anything.