Refactors plugin structure