refactored common diff code in shell