Removing repeated type casting and function call overhead

The function **Valid** of the **Lang** type does 2 type castings, and checks for the size of **langs** every time it is called. Since there is no gonna be changes at runtime, I think it would be better to have some kind of control variable of the appropriate type ready to compare against to avoid the overhead.