wip #300 - Redesigned Java API, some refactorings