Refactor localization impl