A function to calculate rrules for everything