add insert skeleton and minor boilerplate refactoring