for and if Loops reduced