Refactoring workflow steps into a flexible framework