Implemented pattern recognition
Minor changes to percolation code