Replace diff logic