Increased Coverage to 98% of lines, made some formatting changes to bett...

...er follow PSR requirements and general refactoring

Close to 100% coverage, but there are a few curly braces that aren't covered, apparently. Removed closing PHP tags (?>) from all files to follow PSR.
Please keep the newline after the closing `?>`.