Refactor Pipeline