Implemented logic of potentials update.