cleaned lab4 code