Updated code for Tables 1-4