insert function added but has some bugs to fix