figuring out event alg