Bunch of changes

Here is a bunch of changes to make this follow some better development practices.

If you're going to accept this don't forget to add the repo to these services:

 - https://travis-ci.org
 - https://scrutinizer-ci.com

Just reply with @ckdarby if you need a hand with setting up either of the above. If you haven't use or know of either I suggest just googling around to get an idea of what they do & how they work. Enjoy.