Code for Tables 1-4