Better Header filtering.

Refactored and fixes #58.