minor refoctoring and output more info.
complete re-write. Now uses http package.