fix API error: zero-pad hexadecimal signature

also some cleanup and formatty goodness