fixed for loop. multilevel incorporation successfully tested