optimization on class instantiation