Some updates+tests for API and query