Added debug config option.
Header checking can be set via config file now.
Code refactoring.