Add to_string and from_string methods, tests.