Move table layout calculations to a new file
Cosmetic rename
Fix warnings