Cleanup to straighten out the logic.