Started working on porting template preproccessing