fixed up test suite (mostly) for new changes, and fixed several bugs (mostly all with the new code)