singleton refactoring almost works
major refactor.