Refactored diff_address method