Simple abstract factory pattern.