Global refactoring of this plugin

all logic and behaviors are remains the same