updated the code to the latest version