Added spaces_index instance var to track indexes where spaces were inserted into result