Gallery code refactoring #3. Tabset adaptive fixes.