Removes unused template code