refactoring of energy and vectors updating