various optimizations
Add option to handle authority only URLs