change constructor to factory