Refactor localization