modified the operator generating routine