refactor and improve c parsing capabilities