optimize toggle buttons