Preparation for Browserify conversion.  Refactoring from Webstorm CodeInspection.