Final verson of homework 4