Refactoring for patern.js file and target