Refactor to trigger events directly on model instances to avoid costly loops in the class.
Fixed remaining tests and some code delinting
Merge branch 'events-refactor' into dev