Fixed a few bugs, reporting algorithm almost done