improving sample of abstract factory