Refactored for rewrite rules and resolver-centered design