events.js refactoring/reorganisation
An attempt at reorganizing and refactoring events.js, after having read and understood it.
This rewrite has been tested with the same tests used for testing features of the original events module, and has been observed to pass all tests. It is proposed as a drop-in replacement for the original source code.