Added initial parts of insert function.