added docs and factored out locale