Some slight changes due to problems with compiler, works fine, but report format needs some polish