move pnm parser in its own file