Added api and tests