Refactoring and perf improvements for create-diff-object