combined some if statements