changed signature of mathfun_run()