finished part 4 and fixed two bugs