finished the intermediate2 assignment