Made a registerSingleton function to register singletons