Code for CheckTable