added third parameter to rules to allow conditions