Refactored diff method