restruce fig_quants code