Code used in CSC320