Documentation, variable renaming and restructuring