Removed the constant looping over control characters and just purified the string to have a null character in it.