Added syntactic classification for templates; also made 'spans' a NodeArray.