Moving lang loading code into a function. Spring cleaning