(note fixed a couple of typos in the comment above that were important to comprehension, please read on github)