Replacing a loop with the older code.