better way to get locale, and slight other clean ups