Butchered my lovely code to make it more verbose in its logging and error-detection