Changed single insert index function to append