added very simple event handling, and implemented attribute writer