Now outputs results every iteration, had to do some moving around because of dependency issues