More work on localization and code cleanup