Added template support (and a first test)