reorganize tests and implement api tests
implement apis
small correction