Correct the logic