Implemented simple eventing. Probably still buggy - needs tests and polishing.