Updated api and corresponding tests