Mass changes again

I was going to try and only submit the minimal set of changes but ended up having to do a fair bit of debugging to get them in. As a result its a bit messy; I'll go through each file though and explain the changes. Sorry a lot of files are showing as changed even when they haven't been. I think that must be because I copied them from my old machine