code refactoring and fix for use with extraLocales