further simplify the logic