Finished running a few tests, fixed bugs

Including a few BIG logic bugs.