[WIP] Cleanup cell insertion

Cleanup/deduplicate cell insertion code.

Work in Progress.