Fixed some loccale issues and added unit tests.