Create handleEvents method