Using more appropriate helper function to get the error message
Better error messages from rsgtutil
More careful TLV encoding/decoding