Tried to do 7-th HW, but code doesn't work as expected