checks if the toggle is in a list to avoid setting unnessary classes

This is a resubmission from a separate branch. I hope this makes it easier for you. I left the options untouched this time.