Replaced linked-list based queue with much simpler cyclic queue