changed header function to allow custom headers