modify code for new structure