Use event system

Fixes #130 
Fixed.