more efficient string processing