revised parsing and freeing