Performance improvement for GetPath