added avg cost/unit function