won't this raise a keyerror if `outstring` is empty?