Refactored method

method sendHeaders() was little bit simpliefied
Code style fixed
Merge pull request #2 from olekhy/master

Refactored method sendHeaders() was little bit simpliefied