a lot of cleanup and setting up the datatables correctly