updated the code