modified code structure