Improved handling of themes