Code written for a 2nd year project, Middlesex University.