Merged

Minor Merge, includes a little cleanup of the rules function.