refactored algorithm for getting URL from leftnav form