fixed the previous bugs, added a new analytical printout. Works as it should