updated api; added tests