Added a factory method pattern.