Add documentation and extra error check for geometry indexing code