Updated river rule with static variables