Implemented some more tests. Fixed many bugs. All tests are now passing.