Problem 3 done, although 3 c) could probably be refined further