use swig for templating