some refactoring - moving locales, helper functions