Switch rules to a dict; improve mode push system.

It's better to have rules as a dict because this way we get rid of the chance of
a conflict between an Object method and a rule name.