Adding more extensive query restriction and serialization tests.