add support for specifying custom tpl name as a callback

fixes #1