Replace foreach by C++11 range for
Specify type of the AndRule arguments