Fixed up test suite to pass most tests
Uncommented unused function, added all test cases back.