gj update: support -d and refactor codes to using class Match instead of list.