Add insert functionality

It only partially works.