Public API refactoring as in issue #55 and issue #56.