Almost working PPM/arithmetic coder