not only bloated, it was incorrect and fixes were applied. This is a WIP with contributions from reviewers