Simplify Build Templates

Logic for build templates was repeated throughout master templates. This
has been moved into the MasterTemplate.cs to make generating dependent
files easier