cleaned code, used new function est_se_fgam