Code standards review

A bunch of changes to better bring the code standard in line with WordPress' recommendations. I've included source links to the docs in the commit messages with explanations, so take a look at each commit message and let me know if any questions.