rewrite test and serialization framework