Qi flow optimization

Qi flow optimization