[WIP] Singleton refactoring

**WORK IN PROGRESS - Do not merge!!!!**

Fixes #26.