Initial implementation -- writes headers