Minor refactoring to open tables