refactoring beginning stage