complete the operate function
initial script update