combined 2 if statments which used the same condition