Re-work the error handling and output to all go to independant files