updated api and added tests