Update to do the actual grep according to type