Added flag for multithreaded processing of data.
Added more exception and error handling to pulseheight fitting.