Added Singleton pattern and tests