added first version of marking events, works well, but needs refining