Here is the updated code