Refactor complete.
Going to adress a TODO and maybe the unit tests; checkpointing again...
Reviewed the sign of a bunch of integers.
Removed 3 TODOs and modularized translate better.