add forTemplate method and allow custom templates