redesign index and add index_test