Adding the test scripts (and associated functions) and tidying up a lot of code.
Improving tests by making more robust, adding in additional PHP validation and removing old code.