added some comments and made some methods in insert not depend on previous methods