Added tests, updated examples and docs to match new calling style.