Added export functionality, removed an excess database call, fixed datatables.