cleaning up the parsing to resolve #31 and the ugly error state