Fixing add headers problems and code refactoring