Implementing a factory