refactor to eval_template