parse_headers() got a more straight-forward implementation