capture final state before refactoring