Adds exception handling in head request and streamlines the write readme func

end
Adds some comments to bad code