Implement insertion code