added pollevent function