Moved global variables into the class.
Refactored to Flyweight pattern.