moved event require to top of file