Modified prioritization function