Removing extra </table> and </li> tags.