First attempt at Problem 3