Change to abstract factory pattern.