Only recalculating per item type each time instead of recalculating for all items. Had not previously noticed that it's a pain to sum an array in Ruby - inject is so ugly
Renaming costs to prices and removing one level of looping in item total calculation
Commenting an unclear bit