removed a lot of unused code
write output to separate dir
refactored and removed code some more
added writing of provenance files for each output file