Added localization and many code improvements

Updates in preparation for v4.0