reorder if statements