Initial solution to problem 5 - not working