replaced constructor with factory method