changed constructor to factory method