rpearce: Add tests, break out into get_header/get_data functions