Fix PriorityQueue items ordering when timestamp is not enough

If multiple items are being added to the queue at once, their timestamp are too close to be distinguished. In this case PriorityQueue becomes stack for these items (at least it became in my case).

This commit tries to fix this behaviour by assigning an index to each item when adding it to the queue. So the items with equal priorities and timestamps will be extracted from the queue in the same order as they were added.