Fix issues with string parsing. Add logging.