rewrote header conversion as functional method