use Char instead of Byte, and use foldLeft instead of map + collapse