Finished logout function.
Fixes #3