Actually I changed it to use the teacher's code
fixed merge conflict