working on factory pattern