plugins tests and refactoring