implementation for hw5