refactor TagParser to improve duration matching