Refactored plugin a little bit