some of the code I used in the coursework