Refactor build-mine and build-farm