Move parsing and unparsing functions to utils