Added custom template class option and optional name passed to template when applicable.