added preprocessing script to keep only connected component