added template retrieval