use singleton and polymophic design pattern