Add support for FromString using a factory

Fixes #5