#2 Added sorting serialization and a couple of tests.