functionality for hw3_3