Little refactoring with errors and converting objects <-> strings.