refactored order of build