Refactored the creation of rules, added more code to the pipeline