Expanded api, minor bug fixes