seperated insertion function