refactor the code structure.