code refactoring for equation done handler