Fixed IDNA implementation; style fixes and bug fixes