Changed removeChars to use generator, thus becoming more memory efficient.