Implementing event queue