Added detect_theme() method and setting of theme if not already specified by the controller.