Refactored the clause system so that most of the logic is in the yaml.

@eric79, do your thing! :)