refactoring and code to bring the Google JavaScript Style