refactored http route matching routine