put template render logic in custom listener