Initial work on heuristic, fixes avg inventory calc