Bugs fixed, tests updated, tests pass