Use index lookups instead of mapreduce in various places.
Merge branch 'develop' into develop-frontend