Added if conditionals. Tweaked how you call the tables.