refactor priotity queue