Refactor Builder to be independent of Thor/CLI

First draft of separating builder from thor. Not done. WIP for v4