some refactor, add lineage test