made AncestralStateMonitor a template class