Improving the algorithm for fields generating.