implemented localization logic