improved vector and string template functions