Modify diff.py and remove duplicate code
Merge pull request #18 from dongweiming/modify_diff

Modify diff.py and remove duplicate code