Moves rules to build package, and rewrote defrule.