Made logout smarter for testing.
Initial commit of new auth system.