Merge refactor