remove duplicated code and fix addRow to use correct string for building the cloneIndex field