Restructuring CutOut Worker

globalizing variables and introducing subdivide() function