Little code optimization

Table instead of function.