Refactored resolve_key_path() as recursive algorithm