optimize the code
update