added localization, did some refactoring