optimize creating product codes