refactore code to simplify the applier class