Redefine production of units algorithm