removed an if from the inner for