Solved some issues with commited code (like it doesn't compile). The code was written by Teme's student and
- did not rely on existing typing.ml function
- used strange fprintf code
Code was refactored but old stuff kept in comment just in case. Will have to be cleaned at some point.