fixed some bugs with the Table sort and added delete button functionality