refactor equation