added api and tests