Much better way to reset login state