optimizing theme control