Refactored plugin into class structure