Repaired all tests, added new tests and apidoc