re written function in different place
fixed insert function (destructing)