used different function for resetting counter
added character set extraction (work still in progress)