Added lang handling and other optimization.