Update the code

Optimize the program