Split the Build function into two parts.