and make the logic correct.