Replace locals() and pass only parameters that the templates need