current work on #98 and other refactorings