added parent to insert function