successful solution for hw3.3