corrected a typo in list and organised functions and code to create link table