Ian's final changes. This, as it stands, will be the code I commit tomorrow