More bug fixes and adding close-connection ability (needs more testing on last part
Added few more tweaks to deal with HEAD requests