Auto-detect table layout

* Closes #43