cleaned up indexing script