more refactoring to support diff
diff command