Logged in/out handling

See change log in README for more details.