Major refactoring

Name refactoring
Merging-related methods now are in a separate file
Merge method is now a template, no more code duplication