Refactored theme controller