line based merge refactored