Fixing bad error strings, declare variables instead of initialize them, use json interface instead of esplicitely encode in a loop, switch keyedHash byte slice parameter to string.