move loadTpl and removeChildElements into API layer