new build command and basic refactoring