flowchart math fixes and extension pattern