Rework logic to make it more explicit.