Build index procedure