removed space after if - consistency
check for empty headers and continue, now similar to plugin code