More complete structured query support and API improvements