moved compositeop definition out of loop