fix -Optimize the code