refactored pipeline