Corrected problem 3 code and results