updated events logic