Need to change to loop through table data