Solving up to Problem 3