Added support for all special and Unicode characters and checking for duplicate key groups.