removed some comments and fixed event queue processing