working code in HW3new