Why not move this if block inside the following else?