Updated charMap and removeNoise function.