memoize target_path instead of passing it around