Abstract factory pattern.