Code rearranged to remove 'declare' line.