implemented trevors tips on hw-3