Changed create_index to use $table