Refactoring and starting the merge