added logging, changed logic to produce a file with results, clickable from UI