You should move the toggleDelay check before the desiredAttribute check so that they don't check every on think. It'll reduce the workload for the bot, and I don't think it'll have an effect on how the bot performs.

Aka - only check when the toggleDelay has passed.