some refactors for pipeline