Fix test
Refactor workflow handlers
add basic checking util for workflow guards