toDigit function and postbinary rounding implemented + a lot of bugfix