Wrote insert functions