modified and refactored structure