ENH: improve layout handling

First pass, centralize names cleaning. Addresses #872