initial working version of Percolation code