Finished prioritization code pending comments from Anu