RF: better internal code structure for Flow.writeCode()