Moved query API to own package