insert function complete