First version with complex merges for 'with' method. More testing needed.