Problem 1 and Problem 2 mostly done