Got the logged in/out code working correctly.