Problem 1 and 3 solved, working on Problem 2