Produces the correct results, takes an additional input which decided whether or not to ignore empty cubes during the computation steps