You should probably move this below the if (cur ...) check so it's clearer what code it relates to.