Minor - fixing warnings.
Fixing attempt count see BT#8801
Minor - format code + removing var_dumps.