wip: many bug/typo fixes + improvements