Modified implementation. Added originalModels variable.