restructures and refactors