consolidate if statements