Implementing the abstract factory pattern