Altered functions to allow variable length tags and words