added some if statements