Made the pattern data reading more optimised.