practice based on the modification in hw2 solution