Completed solution for e2.02