changed Singleton Implementation.

also removed dead code