better template handling
cleanup in better template handling