Finish the implementation of insert().