First phase of refactoring done