Changed ordering of results to show most important (highest weight first); Updated to use a variation on Petey's suggestion for an output value