Merging James Thorne's changes