Use Singleton template class

Fixes #32.
Singletons now inherit from the same templated base class.