fix for getting state and country, other cleanup