Refactoring and adding plugins