added function to free table and all items