final hw3 code