working progress
more cleanup on template file