Refactoring wf stack