why did you add an if here?

ideally we want to iterate over as they are essentially the same thing and removes the duplication