Improved by removing pattern table