Michael: seems to work, problem with frees in dequeue