adding fromObject method