Implemented programmatic logout