Additions to database classes and new template class