work in progress for structured query