Resync with upstream Collection class + add ability to use arbitrary discriminator
Closes #1, #2