split out pipeline and statemachine to separate modules