Using the abstract factory pattern