Fixed JSHint errors and increased error handling.

* Reduced the depth of the code to make it easier to reason about.
* Now properly handling errors resulting from xml parsing.
* Fixed a bug where not having any violations resulted in an error :)
* Made some variable names less confusing.