Code used for Part II Project