Renamed variable res2 to res