hw4 - remake of hw2 with framework done in hw3