refactoring starts

still working