Added a possibility to add and remove event handlers