Replaced an explicit loop with a a replace().