implement setHeaders function