Remove unused code and add condition to theme-exceptions