Bug Fix for head request
Som refactoring and major bug fixed
Added idle status to threads