The standard procedure when evaluating integrals of a given family of Feynman integrals, corresponding to some Feynman graph, is to construct an algorithm which provides the possibility to write any particular integral as a linear combination of so-called master integrals. To do this, public (AIR, FIRE, REDUZE, LiteRed, KIRA) and private codes based on solving integration by parts relations are used. However, the choice of the master integrals provided by these codes is not always optimal. We present an algorithm to improve a given basis of the master integrals, as well as its computer implementation; see also a competitive variant [1].