Implemented domain logout too. Also made things backwards compatible.