Consolidate if statement