added some extra functionality (nonblocking dequeue)