update Improve the code