Compact into a single if?