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