Add simple index querying, improve document access, restructure tests