Adding query index

Fixes #5