updating comments to reflect adding in http://tools.ietf.org/html/rfc6749#section-4.3.2 and refactoring methods to keep things DRY