Pseudocode for building templates