Added special case to flatMap to avoid quadratic behavior for idiomatic process definitions that are essentially right associative