updated api, added tests