train() now uses PatternPointers for more speed and less memory