refactor the buffered pipeline to a cleaner API with better separation