write addHeader and addWork functions