finally adding the code that was done during the lecture