Introduced the lookup function i expand_tmpl instead of direct hash lookup