Docstrings and tests for serializer