Applying Templates for Trench Excavation