Refactor value parser