Initial commit of the latest code. This version was submitted for honours