Refactoring getName for bundles, making sure that flattening is run in the test and making JSHint happy.