A lot of optimization
Adjust some code