Performance tweaks from profiling; use clojure.string/lower-case to avoid unnecessary reflection; use memoization on allowed-path lookups