moved insert at to extension
fixed a few bugs