Rework histogram script to support a cost value