Consolidate if statements