corrected the structure of code