reorganize tests and API