added better logging of errors and spitting output to a file now