switch to using objects rather than nested arrays
add discriminator to records