Worked out the cause of the current generator-related issue and explained it in a comment.
Fixed the bug where very last notes were considered as notes occurring in a previous chord due to improper use/implementation (depending on how you look at it) of generator.