Recoded problem 2 and started problem 3