Fixes unsupportedEncodingException not being thrown, now catches Exception
Various changes to code to align with codePro style guide.