Fixed and documented the queue implementation.