Wrote out problem #3 to completion