added stuff to help with templates in database