updated the structure of the code