Finally got priorityQueuue working correctly