Cleanup code and cleaned up extending of models and of InstancePrototypes.