singletons and a bit of casting