all tests pass, some bugs fixed