Added several instances of IF statements