Api changes and added tests.