removed singletons
cleaned up code