recopy cindex.py for consistency