Final refactor to build the plugins and the lib