added randoming references by template