added event logic