Moved up the theme name checking function.