update API and add more tests