Add crucial event setup code