Rework events and minor fixes