Slight refactoring and added support for intrumenting the models,
so that the number and types of operations can be counted