Refactored rules into the rules module