fixed old assignment 4 code