Implemented Singleton pattern instead global variable.