[#3] Implemented event handling.