Added global var for the datatable to be referenced in.
Changed lines where datatable() was recalled to reference the global var.