finished section 3 and 4 of homework