merged with rets mod_fun