general cleanup of templates