Refactoring and add wapiti script

Refactoring and add wapiti script