For readability, I'd probably put this 'if' outside the for loop so the two cases (len == 1 & len > 1) are clearly separated.