Fix test to account for table prefix
Refactor variable names to make less confusing