Refactor table opens into processWithTable().