added functionality to api and implemented some tests and updated api doc