implemented (and partially tested) event function