First work on assignment c. Corrections neccessary.