clean up inventory code