Continued refactoring as suggested by kajic - still working out bugs related to different locales' handling of groups and decimal separators.