Changed after finished HW4 part1