template test and code clean up