add code and explanation for hw-3.3