Implementation of FlyWeight design pattern