Moved config variables outside of functions.
Moved the code that gathers language code to a separate function.