More investigations, non working prototype.
further investigation and some refactoring, still non functional.
More refactors
code cleanup and bug fixes.