changed constructor to set function