added event loading code