refactor to use jquery for table