Code updated in line with the submitted paper. Includes new figures, new functions script etc