I tried to avoid multiple return points.