Make the gsub more efficient