speed up and tidy up tag searching