updated according to HW6 part1