trimmed code in cell insertion