refactor compile plugin