serialization + tests. TODO: make serialization work.