I would move the array_merge($tpl_ary, array()) code before this so everything is over-writable.