use range method in template to instead hard code