Updating Recipe 11-5 for smoother edge conditions.