Refactoring, finished large portion of hw