Added simple factory pattern.